<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>
  
  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">
  
    <div class="panel panel-default x-panel x-panel-layout">
    
      <div class="panel-heading">
        <ol class="breadcrumb clearfix">
          <li><a href="${ctx.host}/content">电商管理</a></li>
          <li class="active">产品管理</li>
          <li class="no-before pull-right" style="min-width: 65px;">
            <a onclick="window.history.back();"><i class="glyphicon glyphicon-arrow-left"></i>&nbsp;&nbsp;返回</a>
          </li>
        </ol>
      </div>
      
      <div class="panel-body">
      
        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>
        
        <div class="col-xs-10 x-panel-layout-right">
        
          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>产品管理&nbsp;-&nbsp;产品详情</span></h2>
            </div>
          </div>
          
          <div  class="x-breadcrumb-wrapper top-margin-20" style="position: relative;">
            <ul class="nav nav-pills x-breadcrumb-nav">
              <li class="pull-left active"><a href="${ctx.host}/products/${product.id}">基本信息</a></li>
              <li style="${not empty product.address and product.type.others ? 'display: none' : ''}" class="pull-left" ><a href="${ctx.host}/products/${product.id}/description/edit">产品文案</a></li>
            </ul>
            <a href="${ctx.host}/products/${product.id}/edit" data-target="#edit-product" data-toggle="modal" class="hover-no-text-decoration" style="position: absolute; right: 0px; top: 0px; margin-top: 10px; margin-right: 165px;" title="编辑">编辑信息</a>
            <a href="${ctx.host}/products/${product.id}/cover" data-target="#edit-cover" data-toggle="modal" class="hover-no-text-decoration" style="position: absolute; right: 0px; top: 0px; margin-top: 10px; margin-right: 90px;" title="编辑">修改封面</a>
            <a href="${ctx.host}/products/${product.id}/qrcode" data-target="#edit-qrcode" data-toggle="modal" class="hover-no-text-decoration" style="position: absolute; right: 0px; top: 0px; margin-top: 10px; margin-right: 10px;" title="编辑">修改二维码</a>
          </div>
          
          <div class="col-xs-12">
            <div class="form-horizontal bottom-margin-20" style="margin-top: 20px;">
              <div class="form-group">
                <label class="col-xs-2 control-label">产品名称：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static">${product.name}&nbsp;${product.course.individual ? product.course.hours : ''}${product.course.individual ? '课时' : ''}</p>
                </div>
              </div>
              <div class="form-group">
                <label class="col-xs-2 control-label">产品简介：</label>
                <div class="col-xs-8 pull-left">
                  <p class="form-control-static">${product.summary}</p>
                </div>
              </div>
              <div class="form-group">
                <label class="control-label col-xs-2">创建时间：</label>
                <div class="col-xs-6 pull-left">
                  <p class="form-control-static">
                   <fmt:formatDate value="${product.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                  </p>
                </div>
              </div>
              
              <div class="form-group">
                <label class="control-label col-xs-2">原&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;价：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static">&yen;${product.basicOffer / 100}</p>
                </div>
                <label class="control-label col-xs-2">现&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;价：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static">&yen;${product.currentOffer / 100}</p>
                </div>
              </div>
              
              <div class="form-group">
                <label class="control-label col-xs-2">产品标签：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static">
                    <c:forEach var="tag" items="${product.tags}">
                      <label class="label label-success label-outline">${tag.value.name}</label>
                    </c:forEach>
                  </p>
                </div>
                <label class="control-label col-xs-2">产品类型：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static">
                    ${product.type.description}<c:if test="${not empty product.category }">&nbsp;-&nbsp;${product.category.name}</c:if>
                  </p>
                </div>
              </div>
              
              <div class="form-group">
                <label class="control-label col-xs-2">产品课程：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static">
                    ${product.course.name}
                  </p>
                </div>
                <label class="control-label col-xs-2">产品状态：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static"><label class="label label-${product.status.css} label-outline">${product.status.des}</label></p>
                </div>
              </div>
              
              <c:if test="${product.type.offline}">
                <div class="form-group">
                  <label class="control-label col-xs-2">可购买门店：</label>
                  <div class="col-xs-4 pull-left">
                    <p class="form-control-static">
                    <c:forEach var="site" items="${persist.sites}">
                      <c:if test="${product.siteIdsAsLong.contains(site.id)}">
                        <label class="label label-info label-outline">${site.name}</label>
                      </c:if>
                    </c:forEach>
                    </p>
                  </div>
                </div>
              </c:if>
              
              <div class="form-group">
                <label class="control-label col-xs-2">分享链接：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static">${product.shareUrl}</p>
                </div>
                <label class="control-label col-xs-2">产品链接：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static">${product.address}</p>
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-xs-2 control-label">产品封面：</label>
                <div class="col-xs-4 pull-left">
                  <img src="${cloud.prod}/${product.cover}-0.6" style="width: 280px; height: 168px;">
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-xs-2 control-label">二&nbsp;&nbsp;维&nbsp;&nbsp;码：</label>
                <div class="col-xs-4 pull-left">
                  <c:choose>
                    <c:when test="${empty product.qrcode}">
                      <p class="form-control-static">暂无二维码，请上传</p>
                    </c:when>
                    <c:otherwise>
                      <img src="${cloud.prod}/${product.qrcode}-qrcode">
                    </c:otherwise>
                  </c:choose>
                </div>
              </div>
              
            </div>
          </div>
        
        </div>
      
      </div>
    
    </div>
  
  </div>
  
  <%@ include file="/WEB-INF/include/script.jsp"%>
  
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/ecommerce/product/product-view.js">
    <script type="text/javascript">
      require(['page/ecommerce/product/product-view'],function(page){
          page.init();
      })
    </script>
  </d:resource>
  
</body>

</html>